package com.fh.controller.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.fh.controller.base.BaseController;
import com.fh.model.loan.BlackList;
import com.fh.service.blacklist.IBlackListService;
/**
 * 提交黑名单
 * 
 * @author dell、
 *
 */
import com.fh.util.ResultJSON;
import com.fh.vo.Fraud;
@Controller
@RequestMapping("blackList")
public class BlackListController extends BaseController{
	@Autowired
	private IBlackListService service;
	
	 private Logger logger = LoggerFactory.getLogger(BlackListController.class);
	
	/**
	 * 提交黑名单
	 * 
	 * @return
	 */
	@RequestMapping("commitBlackList")
	@ResponseBody
	public ResultJSON commitBlackList(BlackList info){
		ResultJSON json = new ResultJSON();
		logger.info(JSON.toJSONString(info));
		try {
			//提交黑名单
			service.commitBlackList(info);
			json.setMsg("提交成功!");
		} catch (Exception e) {
			json.setSuccess(false);
			json.setMsg(e.getMessage());
			logger.error("提交黑名单失败",e);
		}
		return json;
	}
	
	/**
	 * 提交欺诈
	 */
	@RequestMapping("commitFraud")
	@ResponseBody
	public ResultJSON commitFraud(Fraud info){
		ResultJSON json = new ResultJSON();
		logger.info(JSON.toJSONString(info));
		try {
			//提交欺诈(调用提交欺诈的接口)
			service.commitFraud(info);
			json.setMsg("提交成功!");
		} catch (Exception e) {
			json.setSuccess(false);
			json.setMsg(e.getMessage());
			logger.error("提交欺诈失败",e);
		}
		return json;
	}
}
